import request from '/@/utils/request';

/**
 * 角色API
 *
 * @method list 获取列表
 * @method info 根据id获取信息
 * @method add 添加
 * @method edit 修改
 * @method del 删除
 */
export function useRoleApi() {
	return {
		list: (params?: object) => {
			return request({
				url: '/sys/role/list',
				method: 'get',
				params,
			});
		},
		info: (id?: String) => {
			return request({
				url: '/sys/role/info',
				method: 'get',
				params: { id },
			});
		},
		add: (data?: object) => {
			return request({
				url: '/sys/role/add',
				method: 'post',
				data,
			});
		},
		edit: (data?: object) => {
			return request({
				url: '/sys/role/edit',
				method: 'put',
				data,
			});
		},
		del: (ids?: object) => {
			return request({
				url: '/sys/role/del',
				method: 'delete',
				data: ids,
			});
		},
	};
}
